package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class AddOperation implements IOperation{

    @Override
    public void work(BookList bookList) {
        System.out.println("新增书籍");
        System.out.println("请输入你要新增的图书书名");
        Scanner scan = new Scanner(System.in);
        String name = scan.nextLine();
        System.out.println("请输入你要新增图书的作者");
        String author = scan.nextLine();
        System.out.println("请输入你要新增图书的价格");
        int price = scan.nextInt();

        Book book = new Book(name,author,price);
        bookList.setBook(bookList.getUsedSize(), book);
        System.out.println("新增图书成功！！！");
        bookList.setUsedSize(bookList.getUsedSize()+1);
    }
}
